package com.jic.product.service;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.product.after.request.GoodsPageQueryRequest;
import com.jic.product.after.request.MeStoreListRequest;
import com.jic.product.after.request.ProductSaleNumRequest;
import com.jic.product.after.request.SaveProductRequest;
import com.jic.product.after.response.*;
import com.jic.product.entity.Product;
import com.jic.product.manage.request.*;
import com.jic.product.manage.response.ProductParentResponse;
import com.jic.product.manage.response.ProductResponse;
import com.jic.product.manage.response.ShopInfoResponse;
import com.jic.product.manage.response.ShopProductInfoResponse;
import com.jic.product.rest.request.ProductRestRequest;
import com.jic.product.rest.response.*;
import com.jic.product.store.request.MStoreFrozenRequest;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 商品表
 *
 * @author :
 * @version : v1.0.0
 * @email :
 * @since : 2020-01-10 07:03:01
 */
public interface ProductService {

    RestResult<Product> addProductInfo(Product product, long[] guaranteeId);

    RestResult<Boolean> addProductPriceInfo(Product product, long[] guaranteeId);

    long delete(Long id);

    long update(Product product);

    long updateShopCansale(Product product);

    Product queryByPrimaryKey(Long id);

    List<Product> query(Product product);

    List<Product> queryProductInfoByParentId(Product product);

    PageResult<ProductResponse> queryPage(Product product, Page pageQuery);

    PageResult<ShopInfoResponse> queryShopPage(ShopInfoRequest shop, Page pageQuery);

    PageResult<ShopProductInfoResponse> queryShopProductPage(ShopInfoRequest shop, Page pageQuery);

    ShopInfoResponse getShopInfo(ShopInfoRequest shop);


    List<ProductResponseFront> queryRecommendedProducts();

    List<ProductPropertyResponseFront> queryProductsPropertyById(long id);

    //h5查询商品基本信息
    ProductInfoResponse queryByProductId(long id);

    //查询后台商品信息
    ProductAfterInfoResponse queryByAfterProductId(long id);

    //查询商品图片和价格
    ProductAfterInfoByIdResponse queryProductInfoById(long id);

    /**
     * 根据商品三方编码查询商品详情
     *
     * @param thirdProductCode
     * @return
     */
    ProductAfterInfoByIdResponse queryProductInfoBythirdProductCode(String thirdProductCode);

    //查询商品店铺信息
    ShoppingCartResponse queryBusinessInfoByProductId(long id);

    long insert(Product product);

    RestResult saveProductDistribute(ProductDistributeRequest productDistributeRequest);

    //查询所有SKU商品信息
    RestResult<List<ProductSkuResponse>> getSkuListByProdId(Long productId,String promotionId);

    //查询所有平台商品分发给指定商家
    RestResult<Boolean> saveMerchantProduct(SaveProductRequest productInfoRequest);

    //查询商家id分发给指定商家
    RestResult<Boolean> saveStoreProduct(SaveProductRequest productInfoRequest);

    RestResult saveProductDistributeStore(
            ProductDistributeStoreRequest productDistributeStoreRequest);

    //查询系列子品
    RestResult<List<ProductParentResponse>> getProductParent(
            GetProductParentRequest getProductParentRequest);

    //保存系列子品
    RestResult<Boolean> saveProductParent(ProductParentRequest productParentRequest);

    //保存系列子品价格
    RestResult<Boolean> updateProductParentPrice(ProductParentPriceRequest productParentPriceRequest);

    //删除系列子品
    RestResult deleteProductParent(@RequestBody Long productId);

    //渠道分发修改
    RestResult<Boolean> updateProductDistributeStore(
            ProductDistributeStoreRequest productDistributeStoreRequest);

    //查询商品详情
    ProductResponse queryProductInfo(Long id);

    //更新商品状态
    void updateProductInfo(ProductInfoUpdateRequest productInfoUpdateRequest);

    /**
     * 进目录商品查询
     *
     * @param product
     * @return
     */
    List<ProductResponse> queryProductCatalog(Product product);

    //查询所有SKU商品信息后台
    RestResult<List<ProductAfterResponse>> queryProductListByProdId(List<Long> productIds);

    /**
     * 查询店铺商品
     *
     * @param meStoreListRequestList
     * @return
     */
    RestResult<List<MeStoreListResponse>> queryMeStoreList(List<MeStoreListRequest> meStoreListRequestList);

    /**
     * 根据IDs查询商品
     *
     * @param productIds
     * @return
     */
    RestResult<List<ProductResponseFront>> queryProductListByIds(List<Long> productIds);

    RestResult<PageResult<GoodsSpuPageQueryResponse>> queryProductList(
            GoodsSpuPageQueryRequest request);

    /*店铺商品导出查询
     * */
    List<ShopInfoResponse> queryShopProductList(ShopInfoRequest shop);


    /**
     * 根据条件查询spu列表
     *
     * @param request
     * @return
     */
    RestResult<PageResult<GoodsPageQueryResponse>> queryByAllCondition(GoodsPageQueryRequest request);

    /**
     * 根据产品id查询产品信息
     *
     * @param productId
     * @return
     */
    RestResult<GoodsPageQueryResponse> queryMarketById(Long productId);

    /**
     * 平台批量分发商品给商家
     *
     * @param batchProductRequest
     * @return
     */
    RestResult<String> batchPlatformProduct(BatchProductRequest batchProductRequest);

    /**
     * 商家批量分发商品给店铺
     *
     * @param batchProductRequest
     * @return
     */
    RestResult<String> batchMerchantProduct(BatchProductRequest batchProductRequest);

    /**
     * description: 根据类目Id查询当前类目所有商品
     *
     * @author: jackHe
     * @time: 2020/4/28 14:42
     */
    RestResult<PageResult<ProductResponse>> queryProductByCategoryId(ProductRequest productRequest);

    /**
     * 查询SKU列表
     *
     * @param request
     * @return
     */
    RestResult<PageResult<GoodsQueryInfo>> querySkuPageByPromotionId(
            GoodsSpuPageQueryRequest request);


    /**
     * 根据产品父id查询产品信息
     *
     * @param productId
     * @return
     */
    RestResult<List<ProductAfterInfoByIdResponse>> queryProductInfoByParentId(Long productId);

    List<Product> queryAll(Product product);

    /**
     * 冻结库存
     *
     * @param mStoreFrozenRequest
     * @return
     */
    RestResult<Boolean> frozenStock(MStoreFrozenRequest mStoreFrozenRequest);


    /*根据店铺id查询店铺商品
     * */
    PageResult<ShopInfoResponse> queryPorductByStoreId(Product product, Page pageQuery);


    /*查询h5商品信息
     * */
    PageResult<List<ProductResponseFront>> queryRestPorduct(ProductRestRequest productRestRequest);


    /*查询店铺商品
     * */
    List<ProductStoreInfo> queryProductByStoreIds(Product product);

    List<ProductStoreInfo> queryProductBySpuId(Product product);

    List<ProductStoreInfo> queryProductBySpuList(GoodsPageQueryRequest goodsPageQueryRequest);

    List<Long> queryProductByCode(GoodsPageQueryRequest goodsPageQueryRequest);

    List<ProductStoreInfo> queryProductBySpuIds(List<Long> spuIds, Integer canle);

    List<ProductStoreInfo> queryProductListByThirdProductCodes(String codeList);

    /*查询店铺商品
     * */
    PageResult<ProductStoreInfo> queryProductPageByStoreIds(GoodsPageQueryRequest goodsPageQueryRequest, Page pageQuery);

    //通过商品id查规格属性
    List<ProductPropertyResponse> queryPropertyNameByProductId(Long productId);


    //跟新商品销售数量
    Boolean updateProductSaleNum(ProductSaleNumRequest productSaleNumRequest);

    List<ProductStoreInfo> queryProductListBySpuId(Long spuId);

    /**
     * @Autor: zhaowei
     * @Date: 2020/12/6 15:06
     * @Description: 根据type查询商品列表
     */
    RestResult<List<ProductInfoResponse>> queryGoodsByType(ProductDetailRequest request);

    List<ProductResponse> queryBySupplierCode(String supplierCode);
}

